//
//  MYouHuiXVC.m
//  JinChengYun
//
//  Created by 金橙云 on 2017/4/14.
//  Copyright © 2017年 金橙云. All rights reserved.
//

#import "MYouHuiXVC.h"

#import "TodoHttpManager.h"
#import "DouDetailsCell.h"
@interface MYouHuiXVC ()<UITableViewDelegate,UITableViewDataSource>

{
    
    NSArray *_titlArr;
    NSMutableDictionary *_dataDic;
    
    
    NSString *str;
    NSString *str1;
    NSString *str2;
    NSString *str3;
    NSString *str4;
    NSString *str5;
    NSString *str6;
    NSString *str7;
    NSString *str8;
    NSString *str9;
    NSString *str10;
    NSString *str11;
    NSString *str12;
    NSString *str13;
    NSString *str14;
 

}
@property(nonatomic,strong)UITableView *tabView;
@property(nonatomic,strong)NSMutableArray *xingArr;

@end

@implementation MYouHuiXVC

-(void)viewWillAppear:(BOOL)animated
{
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didTDManagerYouHuiXiang:) name:TDManagerYouHuiXiang object:nil];
    
    [_manager userManagerYouHuiXwithID:_IDStr];
}
-(void)didTDManagerYouHuiXiang:(NSNotification *)notifi
{
    if (notifi.object != 0)
    {
        _dataDic = [notifi.object objectForKey:@"data"];
      
        str = [_dataDic objectForKey:@"sq_date"];
        str1 = [_dataDic objectForKey:@"wyxz"];
        str2 = [_dataDic objectForKey:@"fy"];
        str3 =  [_dataDic objectForKey:@"kh_name"];
     
        str5 = [_dataDic objectForKey:@"kh_phone"];
        str6 =  [_dataDic objectForKey:@"sale_area"];
        str7 = [_dataDic objectForKey:@"price"];
        str8 =  [_dataDic objectForKey:@"price_all"];
        
        str9 = [_dataDic objectForKey:@"renchou_yh"];
        str10 =[_dataDic objectForKey:@"acyh"];
        str11 = [_dataDic objectForKey:@"xieyi_price_all"];
        str12 = [_dataDic objectForKey:@"xieyi_dan"];
        str13 = [_dataDic objectForKey:@"remark"];
        str14 =  [_dataDic objectForKey:@"yh"];
        

        
        _xingArr = [[NSMutableArray alloc] initWithObjects:str,str1,str2,str3,str5,str6,str7,str8,str9,str10,str11,str12,str13,str14, nil];
        
        
        
        
        
        
        [_tabView reloadData];
        
    }
}
-(void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self name:TDManagerYouHuiBiao object:nil];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"优惠申请";
    self.view.backgroundColor = BgColor;
    _manager = [TodoHttpManager sharedManager];
    _dataDic = [NSMutableDictionary dictionary];
    
    _titlArr = [NSArray arrayWithObjects:@"申请日期:",@"物业类型:",@"房源位置:",@"客户姓名:",@"联系电话:",@"销售面积:",@"销售表价:",@"表价总价:",@"认筹优惠:",@"案场优惠:",@"协议总价",@"协议单价:",@"备注信息:",@"特别优惠:", nil];
    _tabView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, B_WIDTH, B_HEIGHT) style:UITableViewStylePlain];
    _tabView.delegate = self;
    _tabView.dataSource = self;
    _tabView.rowHeight = 40;
    _tabView.backgroundColor = BgColor
    _tabView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    [self.view addSubview:_tabView];
    

}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _titlArr.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *ID = @"Cell";
    DouDetailsCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell)
    {
        cell = [[DouDetailsCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    if ([cell isKindOfClass:[DouDetailsCell class]])
    {
        if (_xingArr.count !=0)
        {
            
            NSString *str0 = (NSString *)_xingArr[indexPath.row];
            cell.secondLab.text = [NSString stringWithFormat:@"%@",str0];

        
        }
        cell.firstLab.text = _titlArr[indexPath.row];
       
    }
    
    return cell;
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
